/**   
 * @Title: RetResult.java 
 * @Package com.enchantin.endzone.entity 
 * @Description: TODO
 * @author weiwei
 * @date 2015-4-24 上午11:12:39 
 * @version V1.0   
 */
package com.yitong.utils;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author weiwei
 * @Date 2015-4-24
 */
public class RetResult implements Serializable {

	/**
	 * @Fields serialVersionUID : TODO
	 */
	private static final long serialVersionUID = 3758864789222317092L;

	public int code;

	private String msg;

	private boolean flag = true;

	private Object obj;

	private Map<String, Object> data = new HashMap<String, Object>();

	/**
	 * @Description: 默认成功
	 * @param
	 */
	public RetResult() {
		super();
		this.code = RetCode.SUCESS;
		this.msg = ConstantUtils.SUCCESS;
	}

	/**
	 * @return the code
	 */
	public int getCode() {
		return code;
	}

	/**
	 * @param code
	 *            the code to set
	 */
	public void setCode(int code) {
		this.code = code;
	}

	/**
	 * @return the msg
	 */
	public String getMsg() {
		return msg;
	}

	/**
	 * @param msg
	 *            the msg to set
	 */
	public void setMsg(String msg) {
		this.msg = msg;
	}

	/**
	 * @param data
	 *            the data to set
	 */
	public void setData(Map<String, Object> data) {
		this.data = data;
	}

	public void addData(String name, Object value) {
		data.put(name, value);
	}

	public Object getData(String name) {
		return data.get(name);
	}

	/**
	 * @return the data
	 */
	public Map<String, Object> getData() {
		return data;
	}

	/**
	 * @return the flag
	 */
	public boolean isFlag() {
		return flag;
	}

	/**
	 * @param flag
	 *            the flag to set
	 */
	public void setFlag(boolean flag) {
		this.flag = flag;
	}

	/**
	 * @return the obj
	 */
	public Object getObj() {
		return obj;
	}

	/**
	 * @param obj
	 *            the obj to set
	 */
	public void setObj(Object obj) {
		this.obj = obj;
	}

	@Override
	public String toString() {
		return "RetResult [code=" + code + ", msg=" + msg + ", flag=" + flag + ", obj=" + obj + ", data=" + data + "]";
	}
	
	public class ResultMsg {
		
		private Object[] result;

		/**
		 * @return the result
		 */
		public Object[] getResult() {
			return result;
		}

		/**
		 * @param result the result to set
		 */
		public void setResult(Object[] result) {
			this.result = result;
		}
	}
}
